EE150 Project 4 Prof. David Kuijt
Project: Dynamically Managing Arrays of Matrices
Due: Tuesday, November 4, start of class
Project Description:
In this project, you will create and manage a set of matrices through dynamic memory allocation. You are required to work on the project using incremental development approach and build your test suite concurrently. Dynamic memory allocation and de-allocation should be used appropriately for this assignment.
Your program will take a series of matrix processing commands. Commands are grouped into three categories: matrix assignments; matrix operations; and the exit command:
matrix assignment command Each matrix assignment command starts with a single character matrix name (referred as matrix register specifier s), an integer for the number of rows, an integer for the number of columns, followed by values of elements of matrix. For example, the assignment for a 2 by 3 matrix A is
A 2 3 2 5 8 1 3 6
=
A[2][3] 2 5 8
1 3 6
In this project we limit our inputs to no more than 4 matrices (A, B, C, D). /* */
matrix operations command + s1 s2 A matrix operation command is of one of the following three forms:
* s1 s2
^ s1 If two matrix inoled, send error message.
Here s1 and s2 are matrix register specifiers. '+' is for matrix addition; '*' is for matrix multiplication; and '^' is to transpose the matrix. For example
+ A D /*If matrix size is different, send error message. */
* B B
^ C
exit command The exit command is specified by the '$' character. Upon encountering the exit command, your program should terminate execution.
Error Checking:
Your program should check thoroughly for relevant errors. Upon encountering an error, the program should report an informative error message and exit using the exit(1) function. Here are some examples (but not limited to) that your program should detect:
Failure to allocate memory for a matrix
Invalid command (other than A, B, C, D, +, *, ^, $)
Invalid matrix dimensions ( number of rows and columns cannot be negative or 0)
Missing elements
Incompatible dimensions in matrix operations ( + and *)
Think carefully about other relevant errors and implement code that detects, and reports such errors.
Project Organization: /* Separate complicaiton*/ Your implementation should be organized as two separate C code files, "main.c" and "matrix_functions.c". The file "main.c" should contain only the main function and all other functions should be implemented inside "matrix_functions.c". Your development of "matrix_functions.c" should include implementations for all of the interface functions that are declared in "matrix_functions.h". If you need to use additional functions as utilities in your implementation, then these functions should be implemented inside "matrix_functions.c" as non-interface functions (i.e., their prototypes will not appear in "matrix_functions.h" and they will not be called by "main.c").
Unit Testing Requirements:
Your test suite for the project should contain at least 10 meaningful and significantly different tests for the matrix operations program itself including tests of both normal operations, and error detection functionality. In addition, each interface function in "matrix_functions.c" should be tested as well with at least 3 meaningful and significantly different tests.
Each test should be documented properly in its associated README.txt file. The tests should run properly using dxtest utility (either applied to the entire test suite or to an ITS).
Submission Requirements:
When submitting your project, please submit an archive of your entire project directory (i.e., matrix_dynamic.tar.gz). Use LIMITATIONS.txt to document anything that couldn't be fully completed or debugged.
Grading Guidelines:
Functional correctness (normal input and error handling) 50%
Coding conventions, documentation, and style 10%
Follows project organization and interfacing conventions 10%
Tests (Diversity, Correct formulation, and Documentation) 30%
Bonus points (related to functional correctness) that are credited because of explanations in LIMITATIONS.txt
Header file
#ifndef _matrix_functions_h
Unlock the complete assignment
You are viewing the free preview. Purchase this assignment once to reveal the complete resource.
Secure checkout is completed by Stripe.